Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Addon-docs: Fix pnpm+Vite failing to build with @storybook/theming Rollup error #26024

Merged
merged 2 commits into from
Feb 14, 2024

Conversation

JReinhold
Copy link
Contributor

@JReinhold JReinhold commented Feb 13, 2024

Closes #25964

What I did

Deduplicated the three Storybook packages using aliasing instead of the dedupe configuration. I'm guessing there's something internal to Vite's dedupe feature that doesn't play well with our dependency setup and pnpm.

The original deduplication was done to remove the warning about @emotion/react getting loaded multiple times. That happened when users would have a React version other than 18.2.0 installed, because that would cause package managers to unhoist the dependencies in @storybook/addon-docs, creating multiple copies of the same dependencies. Package managers still do that, but with aliasing we ensure that the same exact dependency is always loaded.

I found that the unhoisting issue was only a problem in Yarn and never a problem in npm nor pnpm, for some reason.

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

Given that this bug relies heavily on package manager's resolution, this should not be tested in monorepo sandboxes.

  1. Create a Vite-based sandbox with this branch's canary version
  2. remove resolutions from package.json
  3. Install dependencies
  4. Start Storybook
  5. Open the console in the browser
  6. Navigate to the "Configure" doc
  7. Don't see any warnings about @emotion/react in the console
  8. Build the Storybook successfully
  9. Repeat with npm, pnpm, Yarn v4 and Yarn PnP

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This pull request has been released as version 0.0.0-pr-26024-sha-c64041e4. Try it out in a new sandbox by running npx [email protected] sandbox or in an existing project with npx [email protected] upgrade.

More information
Published version 0.0.0-pr-26024-sha-c64041e4
Triggered by @JReinhold
Repository storybookjs/storybook
Branch jeppe/25964
Commit c64041e4
Datetime Tue Feb 13 22:50:34 UTC 2024 (1707864634)
Workflow run 7893771706

To request a new release of this pull request, mention the @storybookjs/core team.

core team members can create a new canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=26024

@JReinhold JReinhold changed the title use aliases instead of dedupe to deduplicate storybook dependencies in vite Addon-docs: Fix Vite+PNPM failing to build with @storybook/theming Rollup error Feb 13, 2024
@JReinhold JReinhold changed the title Addon-docs: Fix Vite+PNPM failing to build with @storybook/theming Rollup error Addon-docs: Fix pnpm+Vite failing to build with @storybook/theming Rollup error Feb 13, 2024
@JReinhold JReinhold self-assigned this Feb 13, 2024
@JReinhold JReinhold marked this pull request as ready for review February 14, 2024 11:13
@JReinhold JReinhold merged commit 50edeef into next Feb 14, 2024
62 of 64 checks passed
@JReinhold JReinhold deleted the jeppe/25964 branch February 14, 2024 21:00
@github-actions github-actions bot mentioned this pull request Feb 14, 2024
13 tasks
@isshesure
Copy link

Also seeing this issue with @storybook/test

@JReinhold
Copy link
Contributor Author

@isshesure please open a new issue with a minimal reproduction if you think you're running into a bug.

See https://storybook.js.org/docs/contribute/how-to-reproduce

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants